#include "mapmanager.h"
#include <QDebug>
#include <QPainter>
MapManager& MapManager::instance()
{
    static MapManager manager;
    return manager;
}

const QImage &MapManager::background() const
{
    return _background;
}

void MapManager::paintMap(QPainter& painter) const
{
    QRect rect(-2000, -2000, _background.width() + 4000, _background.height() + 4000);
    painter.fillRect(rect, Qt::black);
    painter.drawImage(0, 0, _background);
}

MapManager::MapManager()
{
    if(_background.load(":/image/background.png") == false){
        qDebug() << "加载背景图失败!!!";
    } else {
        qDebug() << "加载背景图成功, width = " << _background.width()
                 << "height = " << _background.height();
    }
}
